package com.android.GernerateKeySet;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

import android.os.Environment;

public class ComfirmPassword {
	public boolean ComfirmPWD(char[] depwd, PasswrodBasedCrypto pwdcrypt, int filelen)
	{
		byte[] data = null;
		try {
			// 개인키 Sdcard에 PVKey file에서 불러옴
			File path = Environment.getExternalStorageDirectory().getAbsoluteFile();
			FileInputStream fis = new FileInputStream(path + "/PVKey");
			data = new byte[filelen];
			while(fis.read(data)!= -1){
				;
			}
			fis.close();

		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO: handle exception
			e.printStackTrace();
		} catch (NullPointerException e){
			e.printStackTrace();
		}
		byte[] DecodedPVKey = pwdcrypt.getDecryptionText(depwd, data);
		if (DecodedPVKey == null) {
			return false;
		} else {
			return true;
		}
	}
}
